<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>vuejs测试</title>
    <script src="vue/vue.js"></script>


</head>
<body>
    <div id="app">
        <button v-on:click="num++">增加</button>
        <button @click="decrement">减少</button>
        <h2>
            {{num}}
        </h2>
        <hr>
        事件冒泡测试:<br>
        <div style="background-color: blue" @click="print('div点击了')">
            <button @click.stop="print('点击了button')">点我试试</button>
        </div>
    </div>
    <hr>
    <br>阻止默认事件:<br>
    <a href="https:\\www.baidu.com" @click.prevent="print('点击了超链接')">百度</a>
<script type="text/javascript">
    let app = new Vue({
        el:"#app",
        data:{
            num:1
        },
        methods:{
            //递减
            decrement(){
                this.num--
            },
            print(str){
                console.log(str)
            }
        }

    });
</script>

</body>
</html>